﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Himall.Entity.Config
{
   public class ProductCommentInfoConfig : EntityTypeConfiguration<ProductCommentInfo>
    {
        public ProductCommentInfoConfig()
        {
            ToTable("Himall_ProductComments");
            Property(item => item.ShopName).HasColumnType("varchar").HasMaxLength(100);
            Property(item => item.UserName).HasColumnType("varchar").HasMaxLength(100);
            Property(item => item.Email).HasColumnType("varchar").HasMaxLength(1000);
            Property(item => item.AppendContent).HasColumnType("varchar").HasMaxLength(1000);
            Property(item => item.ReplyAppendContent).HasColumnType("varchar").HasMaxLength(1000);
            Property(item => item.ReplyContent).HasColumnType("varchar").HasMaxLength(1000);
            Property(item => item.ReviewContent).HasColumnType("varchar").HasMaxLength(1000);
          
            HasRequired(x => x.Himall_Members).WithMany(x => x.Himall_ProductComments).HasForeignKey(x => x.UserId);
            HasRequired(x => x.Himall_OrderItems).WithMany(x => x.Himall_ProductComments).HasForeignKey(x => x.SubOrderId);
            HasRequired(x => x.Himall_Shops).WithMany(x => x.Himall_ProductComments).HasForeignKey(x => x.ShopId);
            HasRequired(x => x.ProductInfo).WithMany(x => x.Himall_ProductComments).HasForeignKey(x => x.ProductId);
        }
    }
}
